import React from 'react';
import './App.css';
import {
    Router,
    Switch,
    RouteWithSubRoutes,
    renderLinkList,
    Redirect
} from "./routes/routeUtil";
import routes from "./routes/index";


export default function App() {
    return (
        <div>
            <nav className="navbar navbar-light bg-primary" >
                <div style={{height: "48px"}}>
                    <a className="navbar-brand text-light" href="https://react.docschina.org/docs/getting-started.html">
                        React测试Demo集锦
                    </a>
                </div>
            </nav>
            <Router>
                <div className="row wh-100">
                    <nav className="col-lg-2 col-md-3 col-sm-4 border-right">
                        <ul className="list-group">
                            {routes.map(route => renderLinkList(route))}
                        </ul>
                    </nav>
                    <div className="col-lg-10 col-md-9 col-sm-8">
                        {/*<Redirect to={'/home'}/>*/}
                        <Switch>
                            {routes.map((route, i) => (
                                <RouteWithSubRoutes key={i} {...route} />
                            ))}
                        </Switch>
                    </div>
                </div>
            </Router>
        </div>
    );
}

